<!DOCTYPE html>
<html lang="zh-CN">

<head>
    <base href="${request.contextPath}/"/>
    <meta name="renderer" content="webkit|ie-comp|ie-stand"/>
    <meta name="viewport" content="width=device-width"/>
    <meta http-equiv="content-type" content="text/html; charset=UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="renderer" content="webkit">
    <meta name="viewport" content="width=device-width, initial-scale=1"/>
    <link rel="icon" href="favicon.ico">

    <title>志愿管理-任务领取管理</title>
    <link href="Content/pace/pace-theme-minimal.css" rel="stylesheet"/>
    <link href="Content/font/css/font-awesome.min.css" rel="stylesheet"/>
    <link href="Content/bootstrap/bootstrap.min.css" rel="stylesheet"/>
    <link href="Content/view/index.css" rel="stylesheet"/>

    <script src="Content/pace/pace.min.js"></script>
    <script src="Content/jquery/jquery-1.10.2.min.js"></script>
    <script src="Content/bootstrap/bootstrap.min.js"></script>
    <script src="Content/jquery/plugin/jqprint/jquery.jqprint-0.3.js"></script>

    <script src="Content/laydate/laydate.js"></script>


    <!--[if lt IE 9]>
    <script src="~/Content/bootstrap/html5shiv.min.js"></script>
    <script src="~/Content/bootstrap/respond.min.js"></script>
    <![endif]-->
    <script>
        function request(d) {
            for (var c = location.search.slice(1).split("&"), a = 0; a < c.length; a++) {
                var b = c[a].split("=");
                if (b[0] == d) if ("undefined" == unescape(b[1])) break; else return unescape(b[1])
            }
            return ""
        };
    </script>
    <script>
//   *LaoNa* 写后台的地址，底下直接饮用
        var controlUrl = '/tblHomeVolunteerMission';
//  *LaoNa*  不知道干啥的，应该是翻页用的，写当前地址
        var lrCurrentUrl = controlUrl+'/Index';
        var lrModuleButtonList;
        var lrModuleColumnList;
        var lrModule;
    </script>
</head>

<body class="Firefox 63.0 lr-uitheme-default">

<div class="lr-layout">
    <div class="lr-layout-center">
        <div class="lr-layout-wrap lr-layout-wrap-notitle">
            <div class="lr-layout-tool">
                <div class="lr-layout-tool-left">
                    <!--<div class="lr-layout-tool-item">
                        <input id="txt_Keyword" type="text" class="form-control" placeholder="请输入要查询求组人的姓名"/>
                    </div>
                    <div class="lr-layout-tool-item">
                        <a id="btn_Search" class="btn btn-primary btn-sm"><i class="fa fa-search"></i>&nbsp;<span
                                class="lrlg">查询</span></a>
                    </div>-->
                </div>
                <div class="lr-layout-tool-right">
                    <div class=" btn-group btn-group-sm">
                        <a id="lr_refresh" class="btn btn-default"><i class="fa fa-refresh"></i></a>
                    </div>
                    <div class=" btn-group btn-group-sm" learun-authorize="yes">
                        <a id="lr_affirm" class="btn btn-default"><i class="fa fa-facebook"></i>&nbsp;<span class="lrlg">完成</span></a>
                        <!--                        <a id="lr_import_public" class="btn btn-default"><i class="fa fa-arrow-down"></i>&nbsp;<span class="lrlg">导入</span></a>-->
                    </div>
                </div>
            </div>

            <div class="lr-layout-body" id="gridtable"></div>
        </div>
    </div>
</div>
<script>
    var selectedRow;
    var refreshGirdData;
    var flag;
    var bootstrap = function (a, b) {
        var c = {
            init: function () {
                c.initGrid();
                c.bind()
            },
            bind: function () {
                /*a("#btn_Search").on("click", function () {
                    var d = a("#txt_Keyword").val();
                    c.search({
                        keyword: d
                    })
                });*/
                a("#lr_refresh").on("click", function () {
                    location.reload()
                });
                a("#lr_show").on("click", function () {
                    var d = a("#gridtable").jfGridValue("id");
                    var f = {}
                    if (b.checkrow(d)) {
                        a.lrSaveForm(top.$.rootUrl + controlUrl + "/SaveForm?keyValue=" + d + "&isshow=1", f, function (h) {
                            if (h.code == 200) {
                                b.frameTab.currentIframe().refreshGirdData();
                            }
                        })
                    }
                });
                a("#lr_hidden").on("click", function () {
                    var d = a("#gridtable").jfGridValue("id");
                    var f = {}
                    if (b.checkrow(d)) {
                        a.lrSaveForm(top.$.rootUrl +  controlUrl + "/SaveForm?keyValue=" + d + "&isshow=0", f, function (h) {
                            if (h.code == 200) {
                                b.frameTab.currentIframe().refreshGirdData();
                            }
                        })
                    }
                });

                a("#lr_affirm").on("click", function () {
                    var d = a("#gridtable").jfGridValue("id");
                    var award = a("#gridtable").jfGridValue("award");
                    var openid = a("#gridtable").jfGridValue("openid");
                    var f = {}
                    if (b.checkrow(d)) {
                        a.lrSaveForm(top.$.rootUrl + controlUrl + "/SaveForms?keyValue=" + d + "&isshow=1"+"&award="+award+"&openid="+openid, f, function (h) {
                            if (h.code == 200) {
                                b.frameTab.currentIframe().refreshGirdData();
                            }
                        })
                    }
                });
                a("#lr_cancel").on("click", function () {
                    var d = a("#gridtable").jfGridValue("id");
                    var award= a("#gridtable").jfGridValue("award");
                    var joinid = a("#gridtable").jfGridValue("joinid");
                    var f = {}
                    if (b.checkrow(d)) {
                        a.lrSaveForm(top.$.rootUrl +  controlUrl + "/SaveFormss?keyValue=" + d + "&isshow=0"+"&award="+award+"&joinid="+joinid, f, function (h) {
                            if (h.code == 200) {
                                b.frameTab.currentIframe().refreshGirdData();
                            }
                        })
                    }
                });


                a("#lr_add").on("click", function () {
                    selectedRow = null;
                    flag = "add";
                    b.layerForm({
                        id: "form",
                        title: "添加",
                        url: top.$.rootUrl +  controlUrl + "/Form",
                        width: 1200,
                        height: 850,
                        callBack: function (d) {
                            return top[d].acceptClick(refreshGirdData)
                        }
                    })
                });
                // a("#lr_edit").on("click", function () {
                //     var d = a("#gridtable").jfGridValue("id");
                //     selectedRow = a("#gridtable").jfGridGet("rowdata");
                //     flag =  "edit";
                //     if (b.checkrow(d)) {
                //         b.layerForm({
                //             id: "form",
                //             title: "加入",
                //             url: top.$.rootUrl +  controlUrl + "/Form?keyValue=" + d,
                //             width: 1200,
                //             height: 850,
                //             callBack: function (e) {
                //                 return top[e].acceptClick(refreshGirdData)
                //             }
                //         })
                //     }
                // });
                //
                // a("#lr_achieve").on("click", function () {
                //     var d = a("#gridtable").jfGridValue("id");
                //     selectedRow = a("#gridtable").jfGridGet("rowdata");
                //     flag =  "achieve";
                //     if (b.checkrow(d)){
                //         b.layerForm({
                //             id: "form",
                //             title: "完成任务",
                //             url: top.$.rootUrl +  controlUrl + "/FormAchieve?keyValue=" + d,
                //             width: 1200,
                //             height: 850,
                //             callBack: function (e) {
                //                 return top[e].acceptClick(refreshGirdData)
                //             }
                //         })
                //     }
                // });

                a("#lr_delete").on("click", function () {
                    var d = a("#gridtable").jfGridValue("id");
                    var f = {}
                    if (b.checkrow(d)) {
                        a.lrSaveForm(top.$.rootUrl + controlUrl + "/SaveForm?keyValue=" + d + "&isshow=3", f, function (h) {
                            if (h.code == 200) {
                                b.frameTab.currentIframe().refreshGirdData();
                            }
                        })
                    }
                });
            },
            initGrid: function () {
                a("#gridtable").jfGrid({
                    url: top.$.rootUrl + controlUrl + "/GetList",
                    headData: [{
                        label: "志愿者",
                        name: "joinname",
                        width: 300,
                        align: "left",
                    }, {
                            label: "活动标题",
                            name: "title",
                            width: 300,
                            align: "left",
                        },{
                        label: "志愿币奖励数量",
                        name: "award",
                        width: 280,
                        align: "left",
                    }
                    // , {
                    //     label: "任务状态",
                    //     name: "state",
                    //     width: 150,
                    //     align: "left",
                    //     formatter: function (d) {
                    //         // return d == zzz,
                    //         switch (d)
                    //         {
                    //             case "0":
                    //             return "待领取";
                    //                 break;
                    //             case "1":
                    //             return "进行中";
                    //                 break;
                    //             case "2":
                    //             return "已完成";
                    //                 break;
                    //             default:
                    //             return "状态异常";
                    //         }
                    //     }
                    // },
                    //     {
                    //     label: "是否展示",
                    //     name: "isshow",
                    //     width: 150,
                    //     align: "left",
                    //     formatter: function (d) {
                    //         return d == 1 ? '<i class="fa fa-toggle-on"></i>' : '<i class="fa fa-toggle-off"></i>'
                    //     }
                    // }
                    ],
                    isPage: true,
                    sidx: "date",
                    sord: "desc",
                    reloadSelected: true,
                    mainId: "id",
                    sidx: "date"
                });
                c.search()
            },
            search: function (d) {
                d = d || {};
                a("#gridtable").jfGridSet("reload", d)
            }
        };
        refreshGirdData = function () {
            a("#gridtable").jfGridSet("reload")
        };
        c.init()
    };
</script>


<script src="Content/view/index.js"></script>

</body>

</html>
